package com.itheima.person.service.impl;

import com.itheima.person.pojo.Person;
import com.itheima.person.service.PersonService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class PersonServiceImpl implements PersonService {

    @Override
    public void save(Person person) {

        System.out.println("PersonServiceImpl.save(" + person + ")");
    }

    @Override
    public void update(Person person) {
        System.out.println("PersonServiceImpl.update(" + person + ")");
    }

    @Override
    public void delete(int id) {
        System.out.println("PersonServiceImpl.delete(" + id + ")");
    }

    @Override
    public List<Person> findAll() {
        System.out.println("PersonServiceImpl.findAll()");
        List<Person> people = Arrays.asList(new Person(1, "王五"), new Person(2, "赵六"));

        return people;
    }


    @Override
    public Person findById(int id) {
        System.out.println("PersonServiceImpl.findById("+id+")");

        Person person = new Person(id, "张三");

        return person;
    }
}